<%@tag description="Overall Page template" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@attribute name="products" required="true" type="java.util.List" %>
<%@attribute name="productTags" required="true" type="java.util.Map" %>
<%@attribute name="message" required="false" type="java.lang.String" %>
<%--
  Created by IntelliJ IDEA.
  User: Khacheresyants.l
  Date: 3/4/14
  Time: 1:38 PM
  To change this template use File | Settings | File Templates.
--%>


<c:choose>
    <c:when test="${not empty message}">
        <div class="alert alert-warning">
            <p>${message}</p>
        </div>
    </c:when>
    <c:otherwise>

        <c:forEach items="${products}" var="product">
            <div class="item">
                <ul class="list-unstyled">
                    <li>
                        <a href="${product.buyUrl}">
                            <img src="${product.imgUrl}"/>
                        </a>
                    </li>
                    <li>
                        <h4>
                            <a href="${product.buyUrl}" rel="nofollow">
                                    ${product.name}
                            </a>
                        </h4>
                    </li>
                    <li>
                        <span class="price">Цена: ${product.price}</span>
                    </li>
                    <li>
                        <span class="glyphicon glyphicon-tags">
                        <c:forEach items="${productTags[product.name]}" var="tag">
                            <a href="<c:url value='/tag/${tag.name}'/>">
                                    ${tag.name}
                            </a>
                        </c:forEach>
                        </span>
                    </li>
                </ul>
            </div>
        </c:forEach>
    </c:otherwise>
</c:choose>


